	// computed: { ...mapGetters(['carts'])}
export default {
	carts: state => state.cart.list,
	// 选中的商品
	selectedCarts: state => state.cart.list.filter(it => it.goods_checked),
	// 选中商品的总金额
	totalMoney: (state, getters)=>getters.selectedCarts.reduce((acc, cur)=>{ return acc + cur.goods_count * cur.goods_price }, 0),
	// 选中商品的总价格
	totalCount: (state, getters)=>getters.selectedCarts.reduce((acc, cur)=>{ return acc + cur.goods_count }, 0),
	
	goodsCount: (state) => {
		// state.cart.list ==> [ 
		// 	{goods_id, goods_count},
		// 	{goods_id, goods_count},
		// ]
		
		return state.cart.list.reduce((acc, cur)=>{
			return acc + cur.goods_count
		}, 0)
	}
}